package com.kaishengit.service;

import java.util.List;

import com.kaishengit.dao.UserDao;
import com.kaishengit.entity.User;
import com.kaishengit.util.String.StringUtil;

public class UserService {

	private UserDao userDao = new UserDao();
	
	public User login(String username,String password){
		User user = userDao.findByName(username);
		if(user != null && user.getPassword().equals(StringUtil.sha1(password))){
			
			return user;
		}
		return null;
	}


	public User findUserByUserId(int id) {
		return userDao.findById(id);
	}

	public User findById(int id){
		
		return userDao.findById(id);
	}

	public List<User> findAllUser() {
		return userDao.findAllUser();
	}

}
